package net.example.lesson4;

import java.util.HashMap;
import java.util.UUID;

public class TestHashMapUnsafe {

    public static void main(String[] args) {
        final HashMap<String, String> map = new HashMap<String, String>(2);
        try {
            Thread t = new Thread(new Runnable() {
                @Override
                public void run() {
                    for (int i = 0; i < 10000; i++) {
                        new Thread(new Runnable() {
                            @Override
                            public void run() {
                                map.put(UUID.randomUUID().toString(), "");
                            }
                        }, "ftf" + i).start();
                    }
                }
            }, "ftf");

            t.start();
            t.join();

        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

}
